package com.github.baichuan.application.scaffold.dto.application;

import com.github.baichuan.application.scaffold.domain.application.Application;
import com.github.baichuan.mapping.Mapping;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;

@Getter
@Schema(title = "应用表单数据")
public class ApplicationForm {
    @Schema(title = "应用域", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "应用域不能为空")
    @Mapping("realm.id")
    private String realmId;

    @Schema(title = "应用名称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "应用名称不能为空")
    @Size(max = 16, message = "应用名称最多16个字符")
    @Mapping
    private String name;

    @Schema(title = "应用编码", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "应用编码不能为空")
    @Size(max = 16, message = "应用编码最多16个字符")
    @Mapping
    private String code;

    @Schema(title = "租户模式", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "租户模式不能为空")
    @Mapping
    private Application.TenantMode tenant;
}
